<!--
 * @Description: 
 * @Date: 2022-07-01 08:50:14
 * @LastEditTime: 2023-05-25 09:57:24
 * @FilePath: \vue3\src\views\vue3Study\children1.vue
-->
<template>
  <div style="background:#9400D3;">
    <div>我叫:{{ mName }}</div>
    <div>我爹叫:{{ fName }}</div>
    <button @click="sayBaba">说话</button>
  </div>
</template>
<script>
import { ref, toRef } from "vue";
export default {
  props: ["fName"],
  setup(props, context) {
    // console.log("setup1111")
    let mName = ref("一打七");
    let fName = toRef(props,'fName')
    function sayBaba() {
      console.log(`${fName}是我${mName.value}的爹`)
      context.emit('eat', mName.value)
    }
    return {
      mName, fName, sayBaba
    };
  },
};
</script>